<?php
session_start();

//If user presses logout button, delete session and redirectrs

if(isset($_GET["logout"])){	
  session_unset();
  session_destroy();
}

//Redirects users based on input assuming that they are not logged in

if(!isset($_SESSION["username"])){
  
  //If the user checked a radio button and submitted

  if(isset($_GET['UserChecker'])){
    $UserChecker = $_GET["UserChecker"];

    //If user checked new user, redirect there

    if($UserChecker==1){
      header("Location:newUser.php");

    //If registered user, redirect to login

    }else if($UserChecker==2){
      header("Location:login.php");
    }
 }
?>
<html>
 <head>
  <title>PHYS FILES</title>
 </head>
  <body>
  Welcome to PHYS FILES SPLASH PAGE!<br>
  Our site is undergoing development and this is the basic implementation of our system.<br>
  Welcome and Enjoy.<br>
  <form method = "GET" >
  <INPUT TYPE = "radio" NAME = "UserChecker" CHECKED VALUE = "1">New User<BR>
  <INPUT TYPE = "radio" NAME = "UserChecker" VALUE = "2">Already a User?<BR>
  <INPUT TYPE = "submit" NAME = "Add" />
  </form>
</body>
</html>
<?php
} else {
  echo 'You have logged into the site here is the user webpage';
?>
  <form method = "GET" >
  <INPUT TYPE = "submit" NAME = "logout" value = "Log Out">
  </form><?php
  }
?>
